<%@page import="com.crm.entity.Opportunity,java.util.List" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:form="http://www.springframework.org/tags/form">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="images/css-crm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
 function getFile(){
   document.getElementById("upfile").click();
 }
 function sub(obj){
    var file = obj.value;
    var fileName = file.split("\\");
    document.getElementById("upload").innerHTML = fileName[fileName.length-1];
    document.myForm.submit();
    event.preventDefault();
  }
</script>
<script type="text/javascript"
	src="<%=application.getContextPath()%>/js/jquery-1.7.2.min.js"></script>
</head>

<body>
	<div id="main">
		<%@ include file="common/header.jsp"%>
		<%@ include file="common/submenu.jsp"%>

		<div id="content">
		<%if(request.getAttribute("msg")!=null){
			out.println(request.getAttribute("msg"));
		}
		%>

			<form action="<%=application.getContextPath()%>/poConfirm/save.do" method="post" id="clidet" enctype="multipart/form-data">
				<div id="work-area2">
					<div class="heading2">Purchase Order Confirmation</div>
					<div class="boxIFS">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td><table width="100%" border="0" cellspacing="0"
										cellpadding="0">
										<tr>
											<td width="18">&nbsp;</td>
											<td width="151">&nbsp;</td>
											<td width="146">&nbsp;</td>
											<td width="55">&nbsp;</td>
											<td width="62">&nbsp;</td>
											<td width="171">&nbsp;</td>
											<td width="59">&nbsp;</td>
											<td width="248">&nbsp;</td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td align="left" valign="top">Reference Number</td>
											<td align="left" valign="top">
											<select name="enqid" id="reflistid"	class="form" style="border: 0px;" id="division1">
													<option value="">Please Select</option>
													<%
                 List<Opportunity> liopp=(List<Opportunity>)request.getAttribute("orders");
                 if(liopp!=null){
                 for(Opportunity op:liopp){
                 %>
													<option value="<%=op.getRefNum()%>"><%=op.getRefNum() %></option>
													<%}} %>
											</select> <!--  <div id="clisname"  style="display: none;" class="result_msg" >
  <label style="font-style: oblique; font-weight: bold; color: red;">The ClientShort Name is Already Exists!Please Choose Another</label>
    </div> -->
											</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">Supplier</td>
											<td align="left" valign="top"><select name="supplier"
												class="form" style="border: 0px;" id="supplierid">
													<option value="">Please Select</option>
											</select>
											</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top"><div id="upload"
													onclick="getFile()">upload supplier Proforma</div>
												<div style='height: 0px; width: 0px; overflow: hidden;'>
													<input id="upfile" type="file" value="upload"
														onchange="sub(this)" name="supplierProforma"/>
												</div>
											</td>
										</tr>
										<tr>
											<td height="5"></td>
											<td height="5" align="left" valign="top"></td>
											<td height="5" align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">&nbsp;
											</td>
											<td align="left" valign="top">&nbsp;</td>
											<td align="left" valign="top">&nbsp;</td>
										</tr>
										<tr>
											<td height="5"></td>
											<td height="40" align="left" valign="top"></td>
											<td height="5" align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
										</tr>
										<tr>
											<td height="5"></td>
											<td height="5" align="left" valign="top"></td>
											<td height="5" align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
											<td align="left" valign="top"></td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td colspan="4" align="left" valign="top"><table
													width="80%" border="0" align="center" cellpadding="0"
													cellspacing="0">
													<tr>
														<td width="18%" align="right" valign="middle">&nbsp;</td>
														<td width="11%" align="right" valign="middle"><input
															name="cdecCheckBox" type="checkbox" value="cdec"
															id="cdecCheckBox" />
														</td>
														<td width="63%">CDEC</td>
														<td width="8%">&nbsp;</td>
													</tr>
													<tr>
														<td height="17">&nbsp;</td>
														<td>&nbsp;</td>
														<td align="left" valign="top">&nbsp;</td>
														<td>&nbsp;</td>
													</tr>

													<tr>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td align="left" valign="top"><div id="cdecUpload"
																style="display: none">
																<div id="upload" onclick="getFile()">upload CDEC</div>
															</div>
															<div style='height: 0px; width: 0px; overflow: hidden;'>
																<input id="upfile" type="file" value="upload"
																	onchange="sub(this)" name="cdecfile"/>
															</div>
														</td>
														<td>&nbsp;</td>
													</tr>

													<tr>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
													</tr>
												</table>
											</td>
											<td colspan="3" align="left" valign="top"><table
													width="80%" border="0" align="left" cellpadding="0"
													cellspacing="0">
													<tr>
														<td width="10%" align="right" valign="middle"><input
															name="materialStatus" type="checkbox" value="radiobutton"
															id="materialStatus" />
														</td>
														<td width="68%">Material Status</td>
														<td width="5%">&nbsp;</td>
														<td width="17%">&nbsp;</td>
													</tr>
													<tr>
														<td height="17">&nbsp;</td>
														<td align="left" valign="top">&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
													</tr>
													<tr>
														<td align="right">&nbsp;</td>
														<td align="left" valign="middle">
															<div id="materialStatusDiv" style="display: none">
																<table width="100%" border="0" cellspacing="0"
																	cellpadding="0">
																	<tr>
																		<td width="13%">FedEx</td>
																		<td width="8%"><input name="courierName"
																			type="radio" value="fedex" />
																		</td>
																		<td width="10%" align="right">DHL</td>
																		<td width="9%"><input name="courierName"
																			type="radio" value="dhl" />
																		</td>
																		<td width="8%" align="right">TNT</td>
																		<td width="8%"><input name="courierName"
																			type="radio" value="tnt" />
																		</td>
																		<td width="13%" align="right">UPS</td>
																		<td width="8%"><input name="courierName"
																			type="radio" value="ups" />
																		</td>
																		<td width="15%" align="right">Other</td>
																		<td width="8%"><input name="courierName"
																			type="radio" value="other" />
																		</td>
																	</tr>
																</table>
																<table width="100%" border="0" cellspacing="0"
																	cellpadding="0">
																	<tr>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																		<td>&nbsp;</td>
																	</tr>
																	<tr>
																		<td width="24%">Tracking Number</td>
																		<td width="61%"><input type="text"
																			name="trackingNumber" id="trackingNumber"
																			class="form" />
																		</td>
																		<td width="15%">&nbsp;</td>
																	</tr>
																</table>
															</div></td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td></td>
														<td>&nbsp;</td>
														<td>&nbsp;</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
										</tr>

										<tr>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</div>
					<div class="boxtable">
						<div class="box3">
							<div class="buttton-main">

								<input type="submit" class="button" value="Track"
									onclick=" javascript : processFormData();" />
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
		<div id="footer"></div>
	</div>
</body>
</html>
<script type="text/javascript">
$("#cdecCheckBox").click(function(){
	$("#cdecUpload").toggle();
});
$("#materialStatus").click(function(){
	$("#materialStatusDiv").toggle();
});
$("#reflistid").change(function(){
	var refno=$("#reflistid").val();
	if(refno!=null){
		//$("#ajaxLoader").show();
	$.ajax({
		url:"<%=application.getContextPath()%>/purchaseOrder/searchSuppliers.do",
		data:"refno="+refno,
		success:function(res){
			var e2=document.getElementById('supplierid');
			$('#supplierid')
		    .find('option')
		    .remove()
		    .end();
			var temp=res.split(",");
			if(temp != null || temp!=" "){
				var o=document.createElement('option');
				o.value="";
				o.text="Please Select";
				e2.options.add(o);
				for(var i=0;i<temp.length-1;i++){
					var o=document.createElement('option');
					o.value=temp[i];
					o.text=temp[i];
					e2.options.add(o);
				}
			}
			
			
		}
	}).done(function(html){
		//$("#ajaxLoader").hide();
		/* alert("Ajax Loading Completed"); */
	}).fail(function(html){
		//$("#ajaxLoader").hide();
		alert("Failed To Load the Data");
	});
	}else{
		jAlert("Please Select Reference Number");
	}
});
</script>
